﻿using HappyDining.HPDNServiceReference;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace HappyDining.MyUserControls
{
    public sealed partial class ItemInfoControl : UserControl
    {
        public event EventHandler CancelRequested;
        public event EventHandler SaveRequested;

        public ItemInfoControl(Item item)
        {
            this.InitializeComponent();
            var bounds = Window.Current.Bounds;
            this.totalFrame.Height = bounds.Height;
            this.totalFrame.Width = bounds.Width;

            this.tenMonTextBox.Text = item.Name;
            this.dvtTextBox.Text = item.Unit;
            this.donGiaTextBox.Text = string.Format("{0:###}", item.Price);
        }

        private void TextBlock_SelectionChanged(object sender, RoutedEventArgs e)
        {

        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (CancelRequested != null)
            {
                this.CancelRequested(sender, EventArgs.Empty);
            }
        }

        
    }
}
